The invention relates to controlling the sleep-to-wake and wake-to-sleep state transitions in a computer system executing an advanced configuration and power interface (ACPI) operating system.
Known power management techniques such as advanced power management (APM) are implemented by basic input-output system (BIOS) instructions stored in read-only memory. The BIOS, through operating system transparent system management interrupts (SMIs), monitored power managed devices and notified the operating system when it was time to put the system to sleep. The operating system, in turn, would notify its device drivers of the impending power state change so they could perform an orderly shutdown of their respective devices. Following device driver operations, control was returned to the BIOS which then performed any hardware specific duties necessary to put the system to sleep. In waking from a sleep state, the system BIOS would first receive control so that it could configure system hardware for returning the system to a working state. Only after the BIOS had performed its configuration tasks was control returned to the operating system.
Under the newer ACPI, when a power management or configuration event occurs the operating system is notified via an operating system visible interrupt known as a system control interrupt (SCI). It is the operating system itself that directs all system and device power state transitions.
The ACPI specification includes tables, BIOS, and hardware registers. (See the "Advanced Configuration and Power Interface Specification" dated Dec. 22, 1996.) ACPI tables are used to describe system information (e.g., supported power states, power sources, clock sources), features (e.g., available hardware devices), and methods for controlling those features (e.g., ACPI control methods). ACPI BIOS is that part of the computer system firmware that implements the ACPI specified interfaces for sleep, wake, and some restart operations, and provides permanent storage of ACPI table information. ACPI registers are used to store and pass event information between the hardware/firmware and an ACPI driver--an operating system level program that directs and coordinates all transitions between working and sleeping states.
The ACPI specification defines a global working state (G0) as that state in which a host processor dispatches and executes user mode (application) threads. In this state, devices (peripherals) may dynamically have their power state changed. The ACPI specification defines a global sleeping state (G1) as that state in which no user mode threads are executed by the host processor. As shown in Table 1, the ACPI specification also defines five types of sleeping states (S1 through S5).
TABLE 1 ______________________________________ ACPI Sleep States Type Description ______________________________________ S1 Low wake-up latency state. No system context is lost and hardware maintains all system context. S2 Similar to S1 except that the operating system is not responsible for maintaining processor or cache context. S3 Processor and cache context are lost. Hardware maintains memory and some processor configuration context. S4 It is assumed that hardware has powered off all devices, although platform context is maintained. S5 Soft off state. Similar to S4 except that no context is saved and no device is enabled to wake the system. A complete boot operation is required to exit the S5 state. ______________________________________
In ACPI terminology, the working state is also referred to as the S0 state. Thus, Sx notation can indicate any possible state, from working (S0) to any type of sleep state (S1 through S5).
Referring to FIG. 1, ACPI registers include fixed 100 and general purpose 102 registers. Fixed registers 100 are required in every ACPI-compatible system and are used to implement ACPI event handing, e.g., transitions to and from the working and sleeping states. General purpose registers 102 are used to process events generated by value-added hardware, e.g., original equipment manufacturer (OEM) supplied components. As shown, ACPI fixed register space includes power management one (PM1) event registers 104, PM1 control registers 106, a power management two (PM2) control register 108, a power management (PM) timer register 110, and processor or PU control registers 112.
Transitions between the global working state and any one of the supported sleeping states are controlled by fields in PM1 event and control registers, 104 and 106 respectively. Referring to FIG. 2, PM1 event registers 104 include an `a` status register (PM1a.sub.-- STS 200) and a `b` status register (PM1b.sub.-- STS 202). Each status register includes a wake status field, WAK.sub.-- STSa 204 and WAK.sub.-- STSb 206. Referring to FIG. 3, PM1 control registers 106 include an `a` control register (PM1a.sub.-- CNT 300) and a `b` control register (PM1b.sub.-- CNT 302). Each control register includes a sleep type field (304 and 306) and a sleep enable field (308 and 310). To transition from the S0 working state to the S3 sleep state, for example, the ACPI driver stores the desired sleep state identifier (i.e., S3) first into SLP.sub.-- TYPa field 304 and then into SLP.sub.-- TYPb field 306. Later, when the ACPI driver sets either sleep enable field (308 or 310), the computer system transitions into the S3 sleep state. While in a sleeping state, any enabled wake-up event/device may set the wake status field (204 or 206). When one of the wake status fields is set, a SCI is generated which allows the ACPI driver to sequence the computer system hardware back to the working state.
Some devices, such as network interface cards (NICs) and modems, are not capable of responding to ACPI wake-up signals. These devices are typically designed to be controlled and configured through BIOS and do not respond to sleep and wake commands issued in accordance with the ACPI specification.